<#assign ctx=springMacroRequestContext.contextPath />
<#include "/macro/publicMacro.ftl">
<#import "/macro/pagination.ftl" as Pagination>

<@header title="CmsArticle简介">
    <link href="<${ctx}/resource/common/css/pagination.css" rel="stylesheet">
    <script src="<${ctx}/resource/common/js/pagination.js"></script>
</@header>

<@body>
<h2 class="module-title">文章详情</h2>

<div class="alert alert-primary" role="alert">
    <button class="btn btn-info" onclick="javascript: history.back(-1);return false;" >返回</button>
</div>

<div class="table-responsive">
    <table class="table">
        <thead>
            <th width="100">名称</th>
            <th>值</th>
        </thead>
        <tbody>
            <tr>
                <td class="alert alert-info" align="center">租户</td>
                <td>${cmsArticle.tenant.name!}</td>
            </tr>
            <tr>
                <td class="alert alert-info" align="center">标题名称</td>
                <td>${cmsArticle.title!}</td>
            </tr>
            <tr>
                <td class="alert alert-info" align="center">文章类型</td>
                <td>${cmsArticle.type!}</td>
            </tr>
            <tr>
                <td class="alert alert-info" align="center">子标题</td>
                <td>${cmsArticle.subTitle!}</td>
            </tr>
            <tr>
                <td class="alert alert-info" align="center">主图片</td>
                <td><img class="img-tdumbnail" widtd="200px" height="200px" src="${cmsArticle.mainImage!}"/></td>
            </tr>
            <tr>
                <td class="alert alert-info" align="center">子图片</td>
                <td><ul class="list-group list-group-horizontal" id="imageList"></ul></td>
            </tr>
            <tr>
                <td class="alert alert-info" align="center">分数</td>
                <td>${cmsArticle.score!}</td>
            </tr>
            <tr>
                <td class="alert alert-info" align="center">内容</td>
                <td>${cmsArticle.content!}</td>
            </tr>
            <tr>
                <td class="alert alert-info" align="center">是否可用</td>
                <td>${cmsArticle.enable.desc!}</td>
            </tr>
            <tr>
                <td class="alert alert-info" align="center">创建人</td>
                <td>${cmsArticle.userId!}</td>
            </tr>
            <tr>
                <td class="alert alert-info" align="center">创建时间</td>
                <td>${(cmsArticle.createTime?string('yyyy-MM-dd hh:mm:ss'))!} </td>
            </tr>
            <tr>
                <td class="alert alert-info" align="center">更新时间</td>
                <td>${(cmsArticle.updateTime?string('yyyy-MM-dd hh:mm:ss'))!} </td>
            </tr>
        </tbody>
    </table>
</div>
</@body>

<@footer>
    <script>
        var subImageStr = '${cmsArticle.subImages}';
        var subImages = [];
        if (subImageStr != '') {
            subImages = subImageStr.split(",");
            for(var i=0; i<subImages.length; i++) {
                $("#imageList").append(buildImg(subImages[i]));
            }
        }

        function buildImg(url) {
            return '<li class="list-group-item"><img width="200px" height="200px" src="' + url + '"/></li>';
        }
    </script>
</@footer>